solve system with matrices